Apparatus and methods for re-compression having a monotonic relationship between extent of compression and quality of compressed image

ABSTRACT

A computerized method for independent disjoint block-level recompression of a first image generated by independent coding of disjoint blocks in a precursor image, the first image having at least one first quantization matrix associated there-with, the method comprising performing at least one independent disjoint block-level compression operation, using a processor on the first image, thereby to generate a re-compressed second image including generating a new quantization matrix and using the new quantization matrix for the independent disjoint block-level compression, including computing a rounding error created by the quantization process utilizing the new quantization matrix and, if needed, adjusting at least one value of the new quantization matrix to reduce a rounding error created by the quantization process utilizing the new quantization matrix.

REFERENCE TO CO-PENDING APPLICATIONS

Priority is claimed from U.S. Provisional Application No. 61/329,217, filed 29 Apr. 2010 entilied “Recompression Of Digital Images Using A Robust Measure Of Perceptual Quality Including Improved Quantization Matrix Computation”; from U.S. Provisional Application No. 61/383,750, filed 17 Sep. 2010 entitled “Recompression Of Digital Images”; from U.S. Provisional Application No. 61/389,828, filed 5 Oct. 2010 entitle “Apparatus And Methods For Re-Compression Having A Monotonic Relationship Between Extent Of Compression And Quality Of Compressed Image”; and from PCT applicaion No. IL2010/000809 filed 5 Oct. 2010, entitled “Apparatus And Methods For Recompression Of Digital Images”.

FIELD OF THE INVENTION

The present invention relates generally to compression of digital images and more particularly to re-compression of digital images.

BACKGROUND OF THE INVENTION

Re-compression of digital images such as jpeg images is well known.

It is desirable to have a monotonic relationship between the extent of compression and the quality of the compressed image.

SUMMARY OF THE INVENTION

Certain embodiments of the present invention seek to provide recompression of images which provides monotony of compressed image quality as a function of extent of compression e.g. by recognizing quantizer values that may cause increased quantization error and avoiding them.

Certain embodiments of the present invention seek to provide a re-compression system comprising apparatus for providing a selected degree of compression; and apparatus for compressing images in accordance with the selected degree of compression, including apparatus for deriving a quantization matrix from the selected quality factor such that the quality score of images compressed using the quantization matrix is monotonically related to the selected degree of compression. The degree of compression may be represented by a Quality Factor (QF) measure used to derive a scaling factor for scaling a given quantization matrix as commonly used, for example, in common JPEG image encoders, or by a Modified Quality Factor MQF (MQF), which can be computed by any of the methods shown and described in Applicant's concurrently filed application entitled “Apparatus and Methods for Recompression of Digital Images”. The QF or the MQF may be user selected using a suitable user input device such as a GUI, generated by a computer algorithm, or predefined in tables.

There is thus provided, in accordance with an aspect of the present invention, a computerized method for independent disjoint block-level recompression of a first image generated by independent coding of disjoint blocks in a precursor image, the first image having at least one first quantization matrix associated therewith, the method comprising performing at least one independent disjoint block-level compression operation, using a processor, on the first image thereby to generate a re-compressed second image including generating a new quantization matrix and using the new quantization matrix for the independent disjoint block-level compression, including computing a rounding error created by the quantization process utilizing the new quantization matrix.

In accordance with an embodiment of the invention, there is provided a method wherein the new quantization matrix is generated by scaling at least one second quantization matrix by at least one scaling factor, thereby to provide at least one scaled matrix, and subsequently computing at least one additional quantization matrix as a weighted average of said at least one scaled matrix with the at least one first quantization matrix.

In accordance with an embodiment of the invention, there is further provided a method wherein the at least one value of the new quantization matrix is adjusted to minimize said rounding error.

In accordance with an embodiment of the invention, there is still further provided a method wherein the at least one value of the new quantization matrix is adjusted to minimize the rounding error.

In accordance with an embodiment of the invention, there is still further provided a method comprising transmitting the re-compressed second image to a remote receiver.

In accordance with an embodiment of the invention, there is still further provided a method wherein the adjusting comprises computing a quantization matrix according to a proposed compression level; for each quantization value in the quantization matrix, computing a rounding error using a proposed quantization value and a corresponding quantization value from the quantization matrix in the original image; for any quantization value whose rounding error is below a given threshold, modify its value by 1 repeatedly, in a given direction, until the rounding error exceeds a predetermined threshold; and when the rounding error exceeds the threshold, use the resulting quantization value.

In accordance with an embodiment of the invention, there is still further provided a method comprising providing a first quantization matrix comprising a JPEG standard matrix.

In accordance with an aspect of the invention, there is provided a computerized system for independent disjoint block-level recompression of a first image generated by independent coding of disjoint blocks in a precursor image, the first image having at least one first quantization matrix associated therewith, the system comprising a disjoint rounding error-reducing block-level compressor operative for performing at least one independent disjoint block-level compression operation on the first image thereby to generate a re-compressed second image including generating a new quantization matrix and using the new quantization matrix for the independent disjoint block-level compression, including computing a rounding error for at least one entry in new quantization matrix and if required adjusting the value of the new quantization matrix to reduce a rounding error created by the quantization process utilizing the new quantization matrix.

In accordance with an aspect of the invention, there is further provided a computerized compression method comprising providing a first image compressed using a known first quantization matrix; providing a candidate second quantization matrix; modifying said candidate quantization matrix, using a processor, such that the modified quantization matrix will provide compressed images whose quality is proportional to the extent of compression; and using the final 2^(nd) quantization matrix to compress the 1^(st) image.

In accordance with an embodiment of the invention, there is still further provided a method wherein the modifying comprises using a candidate-for-final 2^(nd) quantization matrix to evaluate a rounding error between itself and the known 1^(st) quantization matrix, searching for problematic values which fall between 1× corresponding value in the 1^(st) matrix, and 2× corresponding value in the 1^(st) matrix, and replacing each problematic value found in said searching, with a corresponding value in the 1^(st) matrix, thereby to obtain said final 2^(nd)quantization matrix.

In accordance with an embodiment of the invention, there is still further provided a method wherein said modifying comprises providing a candidate second quantization matrix;

for each individual element in candidate second quantization matrix, estimating the rounding error which can be expected given the relationship between the first and candidate second matrices and, while the rounding error is too far from zero, repeatedly change, by one, the individual 2^(nd) matrix element, thereby to obtain the final 2^(nd) quantization matrix.

In accordance with an embodiment of the invention, there is still further provided a method wherein the independent disjoint block-level recompression comprises JPEG recompression.

In accordance with an embodiment of the invention, there is still further provided a method wherein the computing a rounding error comprises computing a difference between a ratio of corresponding quantizer entries in the quantization matrices and the ratio's rounded value.

In accordance with an embodiment of the invention, there is still further provided a method wherein the rounding error comprises an error resulting from rounding a ratio of two corresponding quantizer values in the quantization matrices.

In accordance with an aspect of the invention, there is still further provided a computerized re-compression system comprising apparatus for providing a selected degree of compression; and apparatus for using a processor to compress images in accordance with the selected degree of compression, including apparatus for deriving a quantization matrix from the selected quality factor such that the quality score of images compressed using the quantization matrix is monotonically related to the selected degree of compression.

In accordance with an embodiment of the invention, there is yet further provided a system wherein the degree of compression is represented by a QF measure.

In accordance with an embodiment of the invention, there is still further provided a system wherein the degree of compression is represented by an MQF.

In accordance with an aspect of the invention, there is still further provided a computerized re-compression system comprising apparatus for modifying a candidate quantization matrix to accommodate a known first quantization matrix used to compress at least one first image thereby to generate a modified quantization matrix which will provide at least one re-compressed image, re-compressed from a compressed at least one first image, wherein the quality of the at least one re-compressed image is proportional to the extent of re-compression of the re-compressed image relative to the compressed first image; and

apparatus for employing a processor which uses the modified quantization matrix to re-compress at least the compressed first image.

In accordance with an aspect of the invention, there is still further provided a computerized re-compression method comprising providing a selected degree of compression; and compressing images in accordance with the selected degree of compression, using a processor, including deriving a quantization matrix from the selected quality factor such that the quality score of images compressed using the quantization matrix is monotonically related to the selected degree of compression, and using the quantization matrix to compress the images.

In accordance with an embodiment of the invention, there is still further provided a method comprising determining whether or not to adjust at least one value of the new quantization matrix to reduce a rounding error created by the quantization process utilizing the new quantization matrix and, if so, adjusting at least one value of the new quantization matrix to reduce a rounding error created by the quantization process utilizing the new quantization matrix.

In accordance with an embodiment of the invention, there is still further provided a method wherein the compression level is selected by a user using at least one of an MQF and a QF value.

Also provided is a computer program product, comprising a computer usable medium or computer readable storage medium, typically tangible, having a computer readable program code embodied therein, the computer readable program code adapted to be executed to implement any or all of the methods shown and described herein. It is appreciated that any or all of the computational steps shown and described herein may be computer-implemented. The operations in accordance with the teachings herein may be performed by a computer specially constructed for the desired purposes or by a general purpose computer specially configured for the desired purpose by a computer program stored in a computer readable storage medium.

Any suitable processor, display and input means may be used to process, display e.g. on a computer screen or other computer output device, store, and accept information such as information used by or generated by any of the methods and apparatus shown and described herein; the above processor, display and input means including computer programs, in accordance with some or all of the embodiments of the present invention. Any or all functionalities of the invention shown and described herein may be performed by a conventional personal computer processor, workstation or other programmable device or computer or electronic computing device, either general-purpose or specifically constructed, used for processing; a computer display screen and/or printer and/or speaker for displaying; machine-readable memory, such as optical disks, CDROMs, magnetic-optical discs or other discs; RAMs, ROMs, EPROMs, EEPROMs, magnetic or optical or other cards, for storing, and keyboard or mouse for accepting. The term “process” as used above is intended to include any type of computation or manipulation or transformation of data represented as physical, e.g. electronic, phenomena which may occur or reside e.g. within registers and /or memories of a computer. The term processor includes a single processing unit or a plurality of distributed or remote such units.

The above devices may communicate via any conventional wired or wireless digital communication means, e.g. via a wired or cellular telephone network or a computer network such as the Internet.

The apparatus of the present invention may include, according to certain embodiments of the invention, machine readable memory containing or otherwise storing a program of instructions which, when executed by the machine, implements some or all of the apparatus, methods, features and functionalities of the invention shown and described herein. Alternatively or in addition, the apparatus of the present invention may include, according to certain embodiments of the invention, a program as above which may be written in any conventional programming language, and optionally a machine for executing the program such as but not limited to a general purpose computer which may optionally be configured or activated in accordance with the teachings of the present invention. Any of the teachings incorporated herein may wherever suitable operate on signals representative of physical objects or substances.

The embodiments referred to above, and other embodiments, are described in detail in the next section.

Any trademark occurring in the text or drawings is the property of its owner and occurs herein merely to explain or illustrate one example of how an embodiment of the invention may be implemented.

Unless specifically stated otherwise, as apparent from the following discussions, it is appreciated that throughout the specification discussions, utilizing terms such as, “processing”, “computing”, “estimating”, “selecting ”, “ranking”, “grading”, “calculating”, “determining”, “generating”, “reassessing”, “classifying”, “generating”, “producing”, “stereo-matching”, “registering”, “detecting”, “associating”, “superimposing”, “obtaining” or the like, refer to the action and/or processes of a computer or computing system, or processor or similar electronic computing device, that manipulate and/or transform data represented as physical, such as electronic, quantities within the computing system's registers and/or memories, into other data similarly represented as physical quantities within the computing system's memories, registers or other such information storage, transmission or display devices. The term “computer” should be broadly construed to cover any kind of electronic device with data processing capabilities, including, by way of non-limiting example, personal computers, servers, computing system, communication devices, processors (e.g. digital signal processor (DSP), microcontrollers, field programmable gate array (FPGA), application specific integrated circuit (ASIC), etc.) and other electronic computing devices.

The present invention may be described, merely for clarity, in terms of terminology specific to particular programming languages, operating systems, browsers, system versions, individual products, and the like. It will be appreciated that this terminology is intended to convey general principles of operation clearly and briefly, by way of example, and is not intended to limit the scope of the invention to any particular programming language, operating system, browser, system version, or individual product.

Elements separately listed herein need not be distinct components and alternatively may be the same structure. Some or all of the steps described herein may employ a computer processor, inter alia.

BRIEF DESCRIPTION OF THE DRAWINGS

Certain embodiments of the present invention are illustrated in the following drawings:

FIG. 1 is a simplified flowchart illustration of a re-compression method constructed and operative in accordance with certain embodiments of the present invention.

FIGS. 2A-2D are a graph and tables useful in understanding certain aspects of the re-compression methods shown and described herein.

FIGS. 3A and 3B are graphs of the rounding error and the absolute rounding error obtained with the Q matrix shown in FIG. 2C for each of the 64 Q matrix values, as a function of the MQF.

FIGS. 3C-3D are graphs of the rounding error and the absolute rounding error obtained with the Q matrix shown in FIG. 2C for each of the 64 Q matrix values, as a function of the MQF.

FIG. 4 is a computer coded loop which is useful in conjunction with a quantization matrix computation functionality, according to certain embodiments of the present invention.

FIG. 5A is a simplified flowchart illustration of a method for recompression constructed and operative in accordance with one embodiment of the present invention.

FIG. 5B is a simplified flowchart illustration of a method for recompression constructed and operative in accordance with another embodiment of the present invention.

FIG. 5C is a simplified flowchart illustration of a method for performing the rounding error estimation step of FIG. 5B.

FIG. 6 a is a graph of obtained quality scores vs. MQF for an example image without employing the monotony increasing functionality of FIG. 7.

FIG. 6 b is a graph of obtained quality scores vs. MQF for an example image which employs the monotony increasing functionality of FIG. 7.

FIG. 7 is a simplified flowchart illustration of a method for disabling problematic quantizer values, according to some embodiments of the present invention.

FIG. 8 is a table representing a final quantization matrix after applying a monotony increasing functionality e.g. as shown and described herein.

FIGS. 9A-9 g are tables useful in understanding the problem of increase in rounding error despite finer quantization which is partially or wholly overcome by certain embodiments of the present invention.

FIG. 9 a is a table representing original DCT coefficients after inverse quantization

FIG. 9 b is a table representing a first quantization matrix.

FIG. 9 c is a table representing resulting DCT coefficients after quantization with the matrix of FIG. 9 b and inverse quantization.

FIG. 9 d is a table representing absolute error between the values in FIG. 9 c and the values in FIG. 9 a.

FIG. 9 e is a table representing a second quantization matrix.

FIG. 9 f is a table representing resulting DCT coefficients after quantization with the matrix of FIG. 9 e and inverse quantization.

FIG. 9 g is a table representing absolute error between the values in FIG. 9 f and the values in FIG. 9 a.

FIGS. 10A-10E are tables useful in understanding a quantization matrix computation process operative in accordance with certain embodiments of the present invention.

FIGS. 11A and 11B, taken together, form a simplified flowchart illustration of a computerized method for independent disjoint block-level recompression of a first image generated by independent coding of disjoint blocks in a precursor image, the first image having at least one first quantization matrix associated therewith, the method comprising some or all of the illustrated steps suitably ordered e.g. as follows:

FIG. 12 is a simplified flowchart illustration of a method for generating a new quantization matrix, in accordance with certain embodiments of the present invention.

DETAILED DESCRIPTION OF CERTAIN EMBODIMENTS

The following re-compression method, as illustrated in FIG. 1, is provided in accordance with certain embodiments. The method of FIG. 1 includes some or all of the following steps, suitably ordered e.g. as shown:

Step 10: input JPEG image

Step 20: provide quantization matrix to use for recompression

Step 30: perform monotony increasing process for quantization matrix provided in step 20 such that monotonized quantization matrix will provide compressed images whose quality is proportional to the extent of compression

Step 40: compress the input JPEG image with monotonized quantization matrix generated in step 30

Step 50: output compressed JPEG image

Generally, quality scores e.g. PSNR are not monotonous with the amount of compression applied in a conventional JPEG coder. For example, in subjective evaluations on occasion the quality decreases when the amount of compression is decreased.

For example, one image was found to yield the following perceptual quality score (qualS) vs. MQF: MQF: 70 qualS: 0.4069

MQF: 80 qualS: 0.38005

MQF: 88 qualS: 0.058504

MQF: 92 qualS: 0.86324

MQF: 90 qualS: 0.1638

MQF: 91 qualS: 0.79987

The graph of FIG. 2A shows the actual value obtained when quantizing values 100 (x) and 90 (o) when varying the quantizer value (i.e. quantization matrix element value) from 12 down to 1. Despite the finer quantization, the error often increases. For instance for 100: with Q=10 there is no error whereas for Q=8 there is an error of 4.

According to an embodiment of the present invention, when recompressing an image compressed using a quantization matrix Q1, the quantization matrix Q2 which is /used should be such as to avoid the following situation for any of the entries in the matrices: abs(Q1/Q2 a-round(Q1/Q2 a))=0.5.

It is believed that what causes the non-monotony i.e. drop in quality is not only the absolute quantization error but also its phase, as demonstrated in FIGS. 3A-3D. It is appreciated that in the case of monotone quality almost all quantization element errors are always positive. Therefore, rather than performing adjustments that bound the absolute error, adjustments may be introduced that ‘disable’ errors that cause rounding that are lower than a certain threshold.

The loop illustrated in FIG. 4 may be added to the function that calculates a proposed quantization matrix for recompression, after computing and clipping the values as described herein or as is conventional. The operation of FIG. 4 may be performed only once for each of the 64 quantizer values in an 8×8 quantization matrix, per iteration.

FIG. 5A is a simplified flowchart illustration of a method for recompression constructed and operative in accordance with one embodiment of the present invention. The method of FIG. 5A typically includes some or all of the following steps, suitably ordered e.g. as shown:

Step 510. provide a first image compressed using a known first quantization matrix

Step 520. provide a candidate second quantization matrix e.g. using an iterative process including computation of a modified quality factor, using this MQF to generate a quantization matrix. For example, e.g. as per FIG. 12, two matrices may be combined, including the first quantization matrix used to compress the input JPEG image and a second matrix such as a default JPEG matrix or such as a matrix suited to the image being compressed. The MQF is used to compute a scaling factor, the second matrix is scaled, and a weighted average of the resulting scaled matrix and the first matrix is computed

Step 530. in candidate 2^(nd) matrix, search for “problematic” values which fall between 1× corresponding value in the 1^(st) matrix, and 2× corresponding value in the 1^(st) matrix. Replace each problematic value with corresponding value in the 1^(st) matrix, thereby to obtain a final 2^(nd) quantization matrix

Step 540. use the final 2^(nd) quantization matrix to compress the 1^(st) image

FIG. 5B is a simplified flowchart illustration of a method for recompression constructed and operative in accordance with another embodiment of the present invention. The method of FIG. 5B typically includes some or all of the following steps, suitably ordered e.g. as shown:

Step 550: provide a first image compressed using a known first quantization matrix

Step 560: provide a candidate second quantization matrix e.g. as per FIGS. 12 Step 570: for each element in candidate second quantization matrix:

Step 580: estimate rounding error which can be expected given relationship between first and candidate second matrices, e.g. using method of FIG. 5C

Step 590: If rounding error is too far from zero e.g. too negative e.g. less than −0.1, add/subtract one from current 2^(nd) matrix element and return to step 580

Step 600: once one's have been added/subtracted to all elements in 2^(nd) matrix sufficiently to ensure satisfactory estimated rounding error for all elements in candidate 2^(nd) matrix, use this modified candidate second quantization matrix to recompress first image

FIG. 5C is a simplified flowchart illustration of a method for performing the rounding error estimation step of FIG. 5B. The method of FIG. 5C typically includes some or all of the following steps, suitably ordered e.g. as shown:

Step 610: Compute ‘rounding error’: compute Qr=Qv_input/Qvproposed;

Step 620: Compute: Er=Qr-round(Qr)

Step 630: for each of the 64 elements, while Er<−0.1: (Er will not be smaller than −0.5 because of how it is created), compute: Qv_proposed=Qv_proposed-1 (or +1) then repeat unless it is no longer true that Er<−0.1

After examining a large number of images which were recompressed using some embodiments of the method proposed herein, it was found that both the quality score and the actual perceived image quality are not monotonous with the MQF, which can extend the search process for the optimal MQF in an iterative, perceptually lossless recompression system.

To demonstrate this effect, let V1 be a decoded, quantized DCT value in the original JPEG, and let Q1 be the corresponding quantizer value in the original JPEG Q matrix. Then, the reconstructed value after inverse quantization is V1*Q1. Let Q2 be the corresponding quantizer value used by the quantization matrix in a recompression process. Then V2, the new quantized DCT value, is given by V2=round(V1*Q1/Q2). This value will then be reconstructed at the decoder as V2*Q2.

Therefore, the error introduced by the requantization process is:

Qe=(V1*Q1)−(V2*Q2)=V1*Q1−Q2*round(V1*Q1/Q2)

If the quantization ratio QR is defined to be QR=Q1/Q2, this will result in:

Qe−Q2* (V1*QR-round(V1*QR));

This error depends on the specific DCT coefficient values, but assuming the coefficients are randomly distributed, the error is proportional to QR-round(QR), i.e., the further QR is from an integer value, the higher the expected error.

Further evaluations have shown that the main drop in quality occurs when this rounding error [QR-round(QR)], is highly negative. Therefore, adjustments may be introduced that disable new quantizer values for which the rounding error is lower than a certain threshold.

FIGS. 6 a and 6 b show an example of obtained quality scores vs. MQF for an example image without and with a monotony improving process, respectively. The monotony improving process used for FIG. 6 b but not for FIG. 6 a, is described in FIG. 7. The method of FIG. 7 typically includes some or all of the following steps, suitably ordered e.g. as shown:

Step 710. Compute Q matrix according to proposed MQF, e.g. as per FIG. 12.

Step 720. For each of the 64 q values in Q, compute the rounding error using the proposed q value and the corresponding q value from the quantization matrix in the original image.

Step 730. For any q value whose rounding error is below a given threshold, increase or decrease its value by 1 repeatedly, until the rounding error exceeds the threshold.

Step 740. When the rounding error exceeds the threshold, use the resulting q value.

The process shown in FIG. 7 has two degrees of freedom: selecting the threshold for an unacceptable rounding error, and correcting the proposed quantization value either by increasing or decreasing its value. It was found that one method of implementing the process shown in FIG. 7 is thresholding, e.g. with a threshold of approximately -0.1, with the quantization value decrease approach.

According to further embodiments, an alternative process may be used with respect to the non-monotony problem including: identifying proposed q values that are equal to double or less the original quantization value, i.e. q_new<=2*q_org, and correcting the quantization value to q_org, or 1.1*q_org. FIGS. 6 a and 6 b graphically illustrate an example of obtained quality scores vs. MQF for an example image with and without the monotony fix of FIG. 7, respectively.

FIG. 8 shows an example of applying a monotony fix (monotony increasing) method e.g. as shown and described herein, after computing a new quantization matrix. Values affected by the monotony fix are shown in bold. FIGS. 9 a-9 g show an example of increase in the rounding error despite finer quantization, which demonstrates the importance of ensuring or increasing the monotony of the image quality vs. MQF function e.g. by disabling problematic quantizer values, in accordance with certain embodiments of the present invention.

In particular, FIG. 9 a shows the original DCT coefficients of the input image after inverse quantization. FIG. 9 b shows an example of a quantization matrix used to compress the input image. FIG. 9 c shows the resulting DCT coefficients after quantization with the matrix of FIG. 9 b, and inverse quantization. FIG. 9 d shows the absolute error between the values in FIG. 9 c and the values in FIG. 9 a.

FIG. 9 e shows an example of a second quantization matrix used to compress the input image, which is finer than the matrix of FIG. 9 b, and therefore is expected in theory, although not in practice, to create a higher quality image. FIG. 9 f shows the resulting DCT coefficients after quantization with the matrix of FIG. 9 e and inverse quantization. FIG. 9 g shows the absolute error between the values in FIG. 9 f and the values in FIG. 9 a.

The mean absolute error between the reconstructed coefficients and the original coefficients using the first quantization matrix e.g. average of the values in FIG. 9 d is 1.1. The mean absolute error between the reconstructed coefficients and the original coefficients using the second quantization matrix, which is finer than the first matrix e.g. average of the values in FIG. 9 g, is 1.5. In summary, compressing with a finer quantization matrix can result in an image with lower quality hence the usefulness of the monotony providing or increasing methods shown and described herein.

FIGS. 10A-10E are tables illustrating stages of a quantization matrix computation process useful in conjunction with the methods shown and described herein above:

FIG. 10A is an example quantization matrix used to generate an input JPEG image to be re-compressed.

FIG. 10B is a pre-selected quantization matrix.

FIG. 10C is a scaled quantization matrix, using MQF=90=>scf=0.2.

FIG. 10D is the output of an averaging+clipping stage which may be based on the following formula:

Max{QMinput, round[0.5*(QM1s+QMinput)]}.

FIG. 10E is the output of the monotony increasing stage shown and described herein; matrix elements modified in this stage are shown in bold.

FIGS. 11A and 11B, taken together, form a simplified flowchart illustration of a computerized method for independent disjoint block-level recompression of a first image generated by independent coding of disjoint blocks in a precursor image, the first image having at least one first quantization matrix associated therewith, the method comprising some or all of the illustrated steps suitably ordered e.g. as follows:

In FIG. 11A:

Step 810: performing at least one independent disjoint block-level compression operation, using a processor, on the first image thereby to generate a re-compressed second image including generating a new quantization matrix

Step 820: using said new quantization matrix for said independent disjoint block-level compression, including performing the method of FIG. 11B for at least one of and typically all of the (row, column) positions in the matrices

In FIG. 11B:

Step 830: computing a rounding error created by the quantization process utilizing the new quantization matrix

Step 840: if the rounding error fulfils an unacceptability criterion e.g. the rounding error being more negative than a threshold acceptable rounding value such as but not limited to −0.1, adjusting at least one values of said new quantization matrix to reduce the rounding error created by the quantization process utilizing said new quantization matrix.

FIG. 12 is a simplified flowchart illustration of a method for generating a new quantization matrix, in accordance with certain embodiments of the present invention.

The method of FIG. 12 typically includes some or all of the following steps, suitably ordered e.g. as shown:

Step 910: QO_(ij) (i,j =1 . . . 8) is the quantization matrix of the original image.

QD_(ij) (i,j=1 . . . 8) is a second quantization matrix, for example the default quantization matrix described in the JPEG standard, an optimal JPEG quantization matrix computed for the image, the quantization matrix of the original image, or any other second quantization matrix selected for encoding the image.

MQF is the Modified Quality Factor used in the current iteration of recompression.

Step 915: Compute S, the scaling parameter used to scale the second t quantization matrix QD_(ij) as follows:.

IF MQF<50 S=(5000/MQF)/100 ELSE S=(200−2*MQF)/100.

Step 920: compute scaled quantization matrix QS_(iji) (i,j=1 . . . 8) as follows: QS_(ij)=S*QD_(ij) (i,j=1 . . . 8)

Step 930: generate temporary quantization matrix of the reconstructed image QT_(ij) (i,j=1 . . . 8) as follows:

QT_(ij)=W_(ij)*QS_(ij)+(1−W_(ij))*QO_(ij) (i,j=1 . . . 8) where W_(ij) (i,j=1 . . . 8) is a weighting matrix, with values between 0 and 1.

Step 940: generate quantization matrix of the reconstructed image QRi_(ij) (i,j=1 . . . 8) as follows:

if QT _(ij) >=QO _(ij), then QRi _(ij) =QT _(ij), otherwise, QR _(ij) =QO _(ij)

According to certain embodiments, the quantization matrix is modified only in situations which are likely to cause a high rounding error.

It is appreciated that the monotony improving methods shown and described herein are suitable for implementation inter alia in any system which processes and compresses one or more JPEG images, including decoding and re-encoding the image/s. Typically such a system inputs a JPEG image, decodes it, optionally image processes the decoded image and then encodes to obtain an output JPEG image. Examples of such image processing system are PhotoShop, Windows Image and Fax Viewer, particularly the photograph rotation functionality. The monotony improving methods shown and described herein may be implemented in the JPEG encoder of such systems. The decoding and encoding in the JPEG decoder and encoder respectively may be only partial decoding and encoding, e.g. to the DCT level, rather than full decoding to the pixel level.

Any suitable input device may be used to provide, generate, transmit and/or compress input images for the recompression methods shown and described herein. Any suitable output device or computer display may be used to display images generated by the methods shown and described herein. A computer network may be employed to transmit input images to the recompression systems shown and described herein, or to transmit output images therefrom, to auxiliary computerized systems e.g. using a client-server type relationship between the recipients of output images and providers of input images, on the one hand, and the recompression systems shown herein on the other hand. Any suitable computer processor may be employed to provide any or all of the computational functionalities shown and described herein; any of these, or any combination of these or any suitable portion of these may comprise a module in such a processor. Any suitable form of computerized data storage e.g. computer memory may be employed to store input images to the recompression systems shown and described herein, or output images generated thereby.

The methods and systems shown and described herein may be applicable to formats which are not identical to JPEG but have relevant features in common with JPEG.

The terms “degree of compression” and “compression level” as used herein are generally synonymous, both referring to the extent of reduction in size wrought in the image by (re)compression, this being typically controlled by the magnitude of values in the q matrix, which in turn is normally determined by a user-selected MQF or QF value.

Certain embodiments of the present invention can be implemented in hardware or in software, including implementation in VLSI, in dedicated hardware, in embedded systems with a DSP or CPU (computerized device), or running fully in software on a general purpose computer. Certain embodiments of the present invention are particularly useful in conjunction with or as a module within image recompression systems such as conventional Image recompression and processing systems such as but not limited to software and hardware image encoders, command line PC applications such as ImageMagick and jpegtrans, and any PC imaging software such as PhotoShop, Paint, and Microsoft Office Picture Manager.

It is appreciated that terminology such as “mandatory”, “required”, “need” and “must” refer to implementation choices made within the context of a particular implementation or application described herewithin for clarity and are not intended to be limiting since in an alternative implantation, the same elements might be defined as not mandatory and not required or might even be eliminated altogether.

It is appreciated that software components of the present invention including programs and data may, if desired, be implemented in ROM (read only memory) form including CD-ROMs, EPROMs and EEPROMs, or may be stored in any other suitable computer-readable medium such as but not limited to disks of various kinds, cards of various kinds and RAMs. Components described herein as software may, alternatively, be implemented wholly or partly in hardware, if desired, using conventional techniques. Conversely, components described herein as hardware may, alternatively, be implemented wholly or partly in software, if desired, using conventional techniques.

Included in the scope of the present invention, inter alia, are electromagnetic signals carrying computer-readable instructions for performing any or all of the steps of any of the methods shown and described herein, in any suitable order; machine-readable instructions for performing any or all of the steps of any of the methods shown and described herein, in any suitable order; program storage devices readable by machine, tangibly embodying a program of instructions executable by the machine to perform any or all of the steps of any of the methods shown and described herein, in any suitable order; a computer program product comprising a computer useable medium having computer readable program code, such as executable code, having embodied therein, and/or including computer readable program code for performing, any or all of the steps of any of the methods shown and described herein, in any suitable order; any technical effects brought about by any or all of the steps of any of the methods shown and described herein, when performed in any suitable order; any suitable apparatus or device or combination of such, programmed to perform, alone or in combination, any or all of the steps of any of the methods shown and described herein, in any suitable order; electronic devices each including a processor and a cooperating input device and/or output device and operative to perform in software any steps shown and described herein; information storage devices or physical records, such as disks or hard drives, causing a computer or other device to be configured so as to carry out any or all of the steps of any of the methods shown and described herein, in any suitable order; a program pre-stored e.g. in memory or on an information network such as the Internet, before or after being downloaded, which embodies any or all of the steps of any of the methods shown and described herein, in any suitable order, and the method of uploading or downloading such, and a system including server/s and/or clientls for using such; and hardware which performs any or all of the steps of any of the methods shown and described herein, in any suitable order, either alone or in conjunction with software. Any computer-readable or machine-readable media described herein is intended to include non-transitory computer- or machine-readable media.

Any computations or other forms of analysis described herein may be performed by a suitable computerized method. Any step described herein may be computer-implemented. The invention shown and described herein may include (a) using a computerized method to identify a solution to any of the problems or for any of the objectives described herein, the solution optionally includes at least one of a decision, an action, a product, a service or any other information described herein that impacts, in a positive manner, a problem or objectives described herein; and (b) outputting the solution.

Features of the present invention which are described in the context of separate embodiments may also be provided in combination in a single embodiment. Conversely, features of the invention, including method steps, which are described for brevity in the context of a single embodiment or in a certain order may be provided separately or in any suitable sub-combination or in a different order. “e.g.” is used herein in the sense of a specific example which is not intended to be limiting. Devices, apparatus or systems shown coupled in any of the drawings may in fact be integrated into a single platform in certain embodiments or may be coupled via any appropriate wired or wireless coupling such as but not limited to optical fiber, Ethernet, Wireless LAN, HomePNA, power line communication, cell phone, PDA, Blackberry GPRS, Satellite including GPS, or other mobile delivery. It is appreciated that in the description and drawings shown and described herein, functionalities described or illustrated as systems and sub-units thereof can also be provided as methods and steps therewithin, and functionalities described or illustrated as methods and steps therewithin can also be provided as systems and sub-units thereof. The scale used to illustrate various elements in the drawings is merely exemplary and/or appropriate for clarity of presentation and is not intended to be limiting. 

1. A computerized method for independent disjoint block-level recompression of a first image generated by independent coding of disjoint blocks in a precursor image, the first image having at least one first quantization matrix associated therewith, the method comprising: performing at least one independent disjoint block-level compression operation, using a processor, on the first image thereby to generate a re-compressed second image including generating a new quantization matrix and using said new quantization matrix for said independent disjoint block-level compression, including, for at least one (row, column) position in said matrices: computing a rounding error created by the quantization process utilizing the new quantization matrix and, if the rounding error fulfils an unacceptability—criterion, adjusting at least one values of said new quantization matrix to reduce the rounding error created by the quantization process utilizing said new quantization matrix.
 2. A method according to claim 1 wherein said new quantization matrix is generated by scaling at least one second quantization matrix by at least one scaling factor, thereby to provide at least one scaled matrix, and subsequently computing at least one additional quantization matrix as a weighted average of said at least one scaled matrix with the at least one first quantization matrix.
 3. A method according to claim 1 wherein said at least one value of said new quantization matrix is adjusted to minimize said rounding error.
 4. A method according to claim 2 wherein said at least one value of said new quantization matrix is adjusted to minimize said rounding error.
 5. A method according to claim 1 and also comprising transmitting said re-compressed second image to a remote receiver.
 6. A method according to claim 1 and wherein said adjusting comprises: computing a quantization matrix according to a proposed compression level; for each quantization value in the quantization matrix, computing a rounding error using a proposed quantization value and a corresponding quantization value from the quantization matrix in the original image; for any quantization value whose rounding error is below a given threshold, modify its value by 1 repeatedly, in a given direction, until the rounding error exceeds a predetermined threshold; and when the rounding error exceeds the threshold, use the resulting quantization value.
 7. A method according to claim 1 and also comprising providing a first quantization matrix comprising a JPEG standard matrix.
 8. A computerized system for independent disjoint block-level recompression of a first image generated by independent coding of disjoint blocks in a precursor image, the first image having at least one first quantization matrix associated therewith, the system comprising: a disjoint rounding error-reducing block-level compressor operative for performing at least one independent disjoint block-level compression operation on the first image thereby to generate a re-compressed second image including generating a new quantization matrix and using said new quantization matrix for said independent disjoint block-level compression, including computing a rounding error created by the quantization process utilizing the new quantization matrix and, if the rounding error fulfils an unacceptability criterion, adjusting at least one value of said new quantization matrix to reduce a rounding error created by the quantization process utilizing said new quantization matrix.
 9. A computerized compression method comprising: providing a first image compressed using a known first quantization matrix; providing a candidate second quantization matrix; modifying said candidate quantization matrix, using a processor, such that the modified quantization matrix will provide compressed images whose quality is proportional to the extent of compression; and using the final 2^(nd) quantization matrix to compress the 1^(st) image.
 10. A method according to claim 9 wherein said modifying comprises using a candidate-for-final 2^(nd) quantization matrix to evaluate a rounding error between itself and the known 1^(st) quantization matrix, searching for problematic values which fall between 1× corresponding value in the 1^(st) matrix, and 2× corresponding value in the 1^(st) matrix, and replacing each problematic value found in said searching, with a corresponding value in the 1^(st) matrix, thereby to obtain said final 2^(nd)quantization matrix.
 11. A method according to claim 9 wherein said modifying comprises: providing a candidate second quantization matrix; for each individual element in candidate second quantization matrix, estimating the rounding error which can be expected given the relationship between first and candidate second matrices corresponding elements and, while rounding error is too far from zero, repeatedly change, by one, the individual 2^(nd) matrix element, thereby to obtain said final 2^(nd) quantization matrix.
 12. A method according to claim 1 wherein said independent disjoint block-level recompression comprises JPEG recompression.
 13. A method according to claim 1 wherein said computing a rounding error comprises computing a difference between a ratio of corresponding quantizer entries in said quantization matrices and said ratio's rounded value.
 14. A method according to claim 1 wherein said rounding error comprises an error resulting from rounding a ratio of two corresponding quantizer values in said quantization matrices.
 15. A computerized re-compression system comprising: apparatus for providing a selected degree of compression; and apparatus for using a processor to compress images in accordance with the selected degree of compression, including apparatus for deriving a quantization matrix from the selected quality factor such that the quality score of images compressed using said quantization matrix is monotonically related to the selected degree of compression.
 16. A system according to claim 15 wherein said degree of compression is represented by a QF measure.
 17. A system according to claim 15 wherein said degree of compression is represented by an MQF.
 18. A computerized re-compression system comprising: apparatus for modifying a candidate quantization matrix to accommodate a known first quantization matrix used to compress at least one first image thereby to generate a modified quantization matrix which will provide at least one re-compressed image, re-compressed from a compressed said at least one first image, wherein the quality of the at least one re-compressed image is proportional to the extent of re-compression of said re-compressed image relative to the said compressed first image; and apparatus for employing a processor which uses the modified quantization matrix to re-compress at least said compressed first image.
 19. A computerized re-compression method comprising: providing a selected degree of compression; and compressing images in accordance with the selected degree of compression, using a processor, including deriving a quantization matrix from the selected quality factor such that the quality score of images compressed using said quantization matrix is monotonically related to the selected degree of compression, and using said quantization matrix to compress the images.
 20. A computer program product, comprising a computer usable medium having a computer readable program code embodied therein, said computer readable program code adapted to be executed to implement any of the methods shown and described herein.
 21. A method according to claim 1 and also comprising determining whether or not to adjust at least one value of said new quantization matrix to reduce a rounding error created by the quantization process utilizing said new quantization matrix and, if so, adjusting at least one value of said new quantization matrix to reduce a rounding error created by the quantization process utilizing said new quantization matrix.
 22. A method according to claim 6 wherein said compression level is selected by a user using at least one of an MQF and a QF.
 23. A method according to claim 1 wherein said unacceptability criterion comprises said rounding error being more negative than a threshold acceptable rounding value.
 24. A method according to claim 1 wherein said threshold acceptable rounding value comprises −0.1.
 25. A method according to claim 1 wherein said computing and said if-adjusting steps are performed for all (row, column) positions in said matrices. 